home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / GMS / Source / Asm / Fading / WhiteFade.s < prev   
Encoding:
Text File  |  1997-05-01  |  3.0 KB  |  122 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;AGA White Fade
  3. ;--------------
  4. ;Fades the screen to white, then down to a palette, and exits with a fade
  5. ;to black.
  6. ;
  7. ;This demo can load and fade any picture that you specify at the end of
  8. ;this file.
  9. ;
  10. ;Press left mouse button to exit.
  11.  
  12.     INCDIR    "INCLUDES:"
  13.     INCLUDE    "games/games_lib.i"
  14.     INCLUDE    "games/games.i"
  15.  
  16. CALL    MACRO
  17.     jsr    _LVO\1(a6)
  18.     ENDM
  19.  
  20.     SECTION    "AGAWhiteFade",CODE
  21.  
  22. ;===========================================================================;
  23. ;                             INITIALISE DEMO
  24. ;===========================================================================;
  25.  
  26.     STARTGMS
  27.  
  28. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  29.     move.l    GMSBase(pc),a6
  30.     lea    PictureTags(pc),a1
  31.     CALL    LoadPic
  32.     tst.l    d0
  33.     beq.s    .Error_Picture
  34.  
  35.     CALL    GetScreen
  36.     move.l    d0,Screen
  37.     beq.s    .Error_Screen
  38.     move.l    d0,a0
  39.     move.l    Picture(pc),a1
  40.     move.l    PIC_AmtColours(a1),GS_AmtColours(a0)
  41.     move.w    PIC_Planes(a1),GS_Planes(a0)
  42.     move.w    PIC_ScrType(a1),GS_ScrType(a0)
  43.     move.l    PIC_Data(a1),GS_MemPtr1(a0)
  44.     move.w    #320,GS_ScrWidth(a0)
  45.     move.w    #256,GS_ScrHeight(a0)
  46.     move.w    PIC_Width(a1),GS_PicWidth(a0)
  47.     move.w    PIC_Height(a1),GS_PicHeight(a0)
  48.     move.w    PIC_ScrMode(a1),GS_ScrMode(a0)
  49.     CALL    AddScreen
  50.     tst.l    d0
  51.     beq.s    .Error_Screen
  52.  
  53.     CALL    ShowScreen
  54.  
  55.     bsr.s    Main
  56.  
  57. .ReturnToDOS
  58.     move.l    GMSBase(pc),a6
  59.     move.l    Picture(pc),a1
  60.     CALL    FreePic
  61. .Error_Picture
  62.     move.l    Screen(pc),a0
  63.     CALL    DeleteScreen
  64. .Error_Screen
  65.     MOVEM.L    (SP)+,A0-A6/D1-D7
  66.     moveq    #ERR_OK,d0
  67.     rts
  68.  
  69. ;===========================================================================;
  70. ;                                MAIN CODE
  71. ;===========================================================================;
  72.  
  73. Main:    move.l    Screen(pc),a0
  74.     moveq    #$00,d0    ;d0 = FadeState (reset).
  75.     moveq    #5,d1    ;d1 = Speed of fade.
  76.     moveq    #$000000,d2    ;d2 = Source colour
  77.     move.l    #$ffffff,d5    ;d5 = Destination colour.
  78.     moveq    #00,d3    ;d3 = Start colour
  79.     move.l    GS_AmtColours(a0),d4    ;d4 = Amount of colours.
  80. .f_in    CALL    WaitVBL
  81.     CALL    ColourMorph    ;Do the fade routine.
  82.     tst.w    d0    ;Has the fade finished yet?
  83.     bne.s    .f_in    ;If not, keep doing it.
  84.  
  85.     moveq    #2,d1    ;d1 = Speed of fade.
  86.     move.l    Picture(pc),a1
  87.     move.l    PIC_Palette(a1),a1    ;a1 = Palette to fade to.
  88.     move.l    #$ffffff,d2    ;d2 = Colour we are fading from.
  89. .f_mid    CALL    WaitVBL
  90.     CALL    ColourToPalette    ;Do the fade routine.
  91.     tst.w    d0    ;Has the fade finished yet?
  92.     bne.s    .f_mid    ;If not, keep doing it.
  93.  
  94.     moveq    #2,d1    ;d0 = Speed of fade.
  95.     move.l    Picture(pc),a1
  96.     move.l    PIC_Palette(a1),a1    ;a1 = Palette to fade to.
  97.     moveq    #$000000,d2    ;d2 = Destination colour.
  98. .f_out    CALL    WaitVBL
  99.     CALL    PaletteToColour    ;Do the fade routine.
  100.     tst.w    d0    ;Has the fade finished yet?
  101.     bne.s    .f_out    ;If not, keep doing it.
  102.  
  103.     moveq    #20,d0
  104.     CALL    WaitTime
  105.     rts
  106.  
  107. ;===========================================================================;
  108. ;                                  DATA
  109. ;===========================================================================;
  110.  
  111. Screen:    dc.l    0
  112.  
  113. PictureTags:
  114.     dc.l    TAGS_PICTURE
  115. Picture    dc.l    0
  116.     dc.l    PCA_Options,GETPALETTE|VIDEOMEM
  117.     dc.l    PCA_File,.file
  118.     dc.l    TAGEND
  119. .file    dc.b    "GMS:demos/data/PIC.Loading",0
  120.     even
  121.  
  122.